<template>
	<view class="container">
		<view class="btn" @tap="showCode">
			亮码
		</view>
		<u-popup :show="show" mode="center"  @close="close">
		        <view>
		            <image src="https://hr-api.lanbeiduo.com/api/file/download/user_er_code_2.png" class="code-img"></image>
		        </view>
		</u-popup>
	</view>
</template>

<script setup>
	import {
		ref,
		reactive,
		onMounted,
		unref,
		toRaw,
		toRefs,
		nextTick
	} from 'vue'
	import {
		onInit,
		onLoad,
		onReady,
		onShow,
		onHide,
		onUnload,
		onResize,
	} from '@dcloudio/uni-app'
	import {
		$http,
		toLogin
	} from "@/common"
	const code = ref('')
	onLoad(() => {
		if(uni.getStorageSync('userInfo')){
			let userInfo = JSON.parse(uni.getStorageSync('userInfo'))
			code.value = userInfo.erCode
			console.log(code,'code')
		}else{
			toLogin().then(res=>{
				
			})
		}
	})
	// 创建响应式数据  
	const show = ref(false)
	function close() {  
	  // 关闭逻辑，设置 show 为 false  
	  show.value = false;  
	  // console.log('close');  
	}
	function showCode(){
		show.value = true
	}
</script>

<style lang="scss" scoped>
	.container {
		min-height: 100vh;
		background-color: #F9F9F9;
		padding-top: 200rpx;

		.btn {
			width: 120rpx;
			height: 60rpx;
			border-radius: 10rpx;
			line-height: 60rpx;
			text-align: center;
			background: #3f77f4;
			color: #fff;
			margin: 0rpx auto;
		}
	}
	.code-img{
		width: 500rpx;
		height: 500rpx;
	}
</style>